package stage1.module3.homework4;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;

public class Search {
    public Search(ArrayList<Student> students){
        System.out.println("请输入想要查询的学生学号");
        Scanner sc = new Scanner(System.in);
        int id = sc.nextInt();
        for(Student s : students){
            if(s.getId() == id){
                System.out.println("姓名：" + s.getName());
                System.out.println("年龄：" + s.getAge());
            }
        }
    }
}
